home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / file / managers / git-4.3 / git-4 / git-4.3.7 / src / .gitaction next >
Encoding:
Text File  |  1995-07-08  |  1.7 KB  |  49 lines

  1. #!/bin/sh
  2.  
  3. ###############################################################################
  4. #                                                                             #
  5. #           GNU Interactive Tools 4.3.5 per file type action script           #
  6. #                               Local version                                 #
  7. #        Copyright (c) 1993, 1994, 1995 Free Software Foundation, Inc.        #
  8. #                   Written by Tudor Hulubei and Andrei Pitis.                #
  9. #                                                                             #
  10. ###############################################################################
  11.  
  12. #
  13. # This script executes a different action for each file type specified.
  14. # The script tries to match (using gitmatch) the second parameter against
  15. # the patterns given as command line arguments to gitmatch (see below).
  16. # gitmatch returns 0 if the parameter doesn't match or the number in the
  17. # list of the pattern that matched.
  18. # If you want to add new file types & actions to this script, just add a
  19. # new pattern after the last pattern in the list and a corresponding
  20. # action to the 'case' statement.
  21. #
  22. # For grater flexibility, .gitaction's first parameter is the name of the
  23. # directory where the file resides. So, you can get the complete file
  24. # name appending the file base name to the file path just like that: $1/$2
  25. #
  26.  
  27. name=`basename $0`
  28.  
  29. if test "$#" -ne 2 -o ! -d "$1" -o ! -f "$2"; then
  30.     echo "$name: GIT internal script" >&2
  31.     exit 255
  32. fi
  33.  
  34. gitmatch $2 "*.foo" "*.bar"
  35.  
  36. type=$?
  37.  
  38. case $type in
  39. 1)      $GIT_PAGER $2;;                                 # *.foo
  40. 2)      $GIT_PAGER $2;;                                 # *.bar
  41. esac
  42.  
  43. if test $type != 0; then
  44.     echo
  45.     echo "Press any key ..."
  46. fi
  47.  
  48. exit $type
  49.